package com.gitee.sop.storyweb.controller;

import com.gitee.sop.servercommon.annotation.BizCode;
import com.gitee.sop.servercommon.annotation.Open;
import com.gitee.sop.storyweb.controller.param.StoryParam;
import com.gitee.sop.storyweb.controller.result.StoryResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName Test001_TestController
 * @Description TODO
 * @Author zyy
 * @Date 2022/8/11 11:10
 * @Version 1.0
 **/
@RestController
@RequestMapping("story_test")
@Slf4j
@Api(tags = "故事测试_test接口")
public class Test001_TestController {


    // 指定版本号
    @ApiOperation(value = "获取故事信息1", notes = "获取故事信息的详细信息1")
    @Open(value = "story_test.get", version = "1.0", bizCode = {
            // 定义业务错误码，用于文档显示
            @BizCode(code = "100001", msg = "姓名错误", solution = "填写正确的姓名"),
            @BizCode(code = "100002", msg = "备注错误", solution = "填写正确备注"),
    })
    @GetMapping("/get/v2")
    public StoryResult get_v2(StoryParam param) {
        StoryResult story = new StoryResult();
        story.setId(1L);
        story.setName("海底小纵队(story.get2.0), " + "param:" + param);
        return story;
    }


    // 指定版本号
    @ApiOperation(value = "根据json", notes = "根据json的详细信息1")
    @Open(value = "story_json.get", version = "1.0", bizCode = {
            // 定义业务错误码，用于文档显示
            @BizCode(code = "100001", msg = "姓名错误", solution = "填写正确的姓名"),
            @BizCode(code = "100002", msg = "备注错误", solution = "填写正确备注"),
    })
    @PostMapping("/get_json/v2")
    public StoryResult get_json_v2(@RequestBody StoryParam param) {
        StoryResult story = new StoryResult();
        story.setId(1L);
        story.setName("海底小纵队(story.get2.0), " + "param:" + param);
        return story;
    }

}
